package com.everyday.practice.leetCode;

public class Title1137 {
    public static void main(String[] args) {
        System.out.println(tri(3));
        System.out.println(tri(6));
    }

    public static int tri(int n){
        int t1=0;
        int t2=1;
        int t3=2;
        if(n<=3){
            return n;
        }
        for(int i=4;i<=n;i++){
            int count=t1+t2+t3;
            t1=t2;
            t2=t3;
            t3=count;
        }
        return t3;
    }
}
